Enterprise Objects Framework Release 1.1 Copyright ã1995 by NeXT Computer, Inc.  All Rights Reserved.

EOAttributeOrdering

Inherits From:	NSObject

Conforms To:	NSCopying

Declared In:	eoaccess/EOAttributeOrdering.h

Class Description

EOAttributeOrdering defines the order that an EOAdaptorChannel or EODatabaseChannel fetches rows or objects in. You usually create EOAttributeOrderings and put them into an NSArray for a select operation. The order within the array determines the precedence when sorting. For example, the following code excerpt selects Employee objects so that they'll be fetched alphabetically by last name and then first name:

EOQualifier *empQualifier;         /* Assume this exists. */
EOAttribute *firstNameAttribute;   /* Assume this exists. */
EOAttribute *lastNameAttribute;    /* Assume this exists. */
EODatabaseChannel *myDBChannel;    /* Assume this exists. */
EOAttributeOrdering *firstNameOrdering;
EOAttributeOrdering *lastNameOrdering;
NSArray *nameOrder;
BOOL ok;

firstNameOrdering = [EOAttributeOrdering
    attributeOrderingWithAttribute:firstNameAttribute
    ordering:EOAscendingOrder];
lastNameOrdering = [EOAttributeOrdering
    attributeOrderingWithAttribute:lastNameAttribute
    ordering:EOAscendingOrder];

nameOrder = [NSArray arrayWithObjects:lastNameOrdering,
                     firstNameOrdering, nil];

ok = [myDBChannel selectObjectsDescribedByQualifier:empQualifier
                  fetchOrder:nameOrder];

if (ok) {
    /* Go on to fetch objects. */
}

Instance Variables

 None declared in this class.

Adopted Protocols

NSCopying	- copy
- copyWithZone:

Method Types

Creating an attribute ordering	+ attributeOrderingWithAttribute:ordering:
- initWithAttribute:ordering:

Getting values	- attribute
- ordering

Class Methods

attributeOrderingWithAttribute:ordering:

+ attributeOrderingWithAttribute:(EOAttribute *)anAttribute ordering:(EOOrdering)anOrdering

Returns an EOAttributeOrdering with anAttribute and anOrdering. anOrdering may be EOAnyOrder (no ordering), EOAscendingOrder (lowest-valued attribute first), or EODescendingOrder (highest-valued attribute first).

See also:  - initWithAttribute:ordering:

Instance Methods

attribute

- (EOAttribute *)attribute

Returns the attribute that the ordering is defined for.

initWithAttribute:ordering:

- initWithAttribute:(EOAttribute *)anAttribute ordering:(EOOrdering)anOrdering

Initializes a newly allocated EOAttributeOrdering with anAttribute and anOrdering. anOrdering may be EOAnyOrder (no ordering), EOAscendingOrder (lowest-valued attribute first), or EODescendingOrder (highest-valued attribute first). This is the designated initializer for the EOAttributeOrdering class. Returns self.

See also:  + attributeOrderingWithAttribute:ordering:

ordering

- (EOOrdering)ordering

Returns the ordering defined for the attribute.